using System;
using System.Collections.Generic;
using System.Text;

using AI.AStar;

namespace GameMap
{
    public class StationsNetwork : IAStarSearchSpace
    {
        private List<Station> m_Stations;

        public StationsNetwork()
        {
            m_Stations = new List<Station>();
        }

        public void AddStation(Station newStation)
        {
            m_Stations.Add(newStation);
        }

        public List<Station> Stations
        {
            get { return m_Stations; }
        }

        public Station GetStation(int id)
        {
            foreach(Station st in m_Stations)
            {
                if(st.StationID == id)
                {
                    return st;
                }
            }
            // omg not found!
            return null;
        }

        #region IAStarSearchSpace Members

        public ICollection<IAStarNode> NodesCollection
        {
            get 
            {
                List<IAStarNode> nodesCollection = new List<IAStarNode>();
                foreach (Station st in m_Stations)
                {
                    nodesCollection.Add(st as IAStarNode);
                }
                return nodesCollection;
            }
        }

        #endregion
    }
}
